/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simplemetrosystem.view.table;

import java.awt.Color;
import java.awt.GridBagLayout;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextField;
import simplemetrosystem.model.charlanguage.NameMap;
import simplemetrosystem.view.Layout.GBC;
import simplemetrosystem.view.InformationPane;

/**
 *
 * @author Eric Qian
 */
public class SearchPane extends JPanel {

    /**
     * 
     * @param infPane
     */
    public SearchPane(InformationPane infPane) {
        this.infPane = infPane;
        nameMap = NameMap.getInstance();
        this.setBorder(BorderFactory.createLineBorder(Color.BLACK));
        loadComponenet();
    }

    private void loadComponenet() {
        setLayout(new GridBagLayout());
        add(getTextField(),new GBC(0,0).setWeight(1, 1).setFill(GBC.BOTH));
        add(getSearchButton(),new GBC(1,0));
    }

    private JTextField getTextField() {
        if (textField == null) {
            textField = new JTextField();
        }
        return textField;
    }

    private JButton getSearchButton() {
        if (searchButton == null) {
            searchButton = new JButton();
            searchButton.setText(nameMap.getName("Search"));
        }
        return searchButton;
    }
    private InformationPane infPane;
    private NameMap nameMap;
    private JTextField textField;
    private JButton searchButton;
}
